<?php

namespace App\Model;

use Illuminate\Support\Facades\DB;

class RoomType extends BaseModel
{
    protected $table = 'room_type';

    public static function roomTypeList($input = [])
    {
        $where['certified'] = $input['type'] ?? 1;
        $res =  DB::connection('api')->table('room_type')
            ->where($where)
            ->orderBy('sort','desc')
            ->get();
        return objToArray($res);
    }
    //获取客户端房间类型列表
    public static function getRoomTypeList()
    {
        $where['certified'] = 1;
        $where['is_show'] = 1;
        $res =  DB::connection('api')->table('room_type')
            ->where($where)->get();
        return objToArray($res);
    }

    //根据id合集
    public static function getRoomTypeInIds($ids = [])
    {
        return DB::connection('api')->table('room_type')
            ->whereIn('type_id', $ids)
            ->get();
    }

    //根据名称获取
    public static function getRoomTypeInTypeName($name = [])
    {
        return DB::connection('api')->table('room_type')
            ->whereIn('type_name', $name)
            ->get();
    }
}
